package com.ruoyi.driver.pay.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.driver.pay.service.IDriverPayService;
import com.ruoyi.passenger.order.domain.TOrder;
import com.ruoyi.passenger.pay.ro.PayParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * 支付
 * 
 * @author ruoyi
 */
@RestController
@RequestMapping("/driver/pay")
public class DriverPayController extends BaseController
{

    @Autowired
    private IDriverPayService driverPayService;

    @ApiOperation(value = " 乘客支付", notes = "乘客支付")
    @GetMapping("/getQrcode")
    public AjaxResult getQrcode(PayParam param) {
        LoginUser loginUser = getLoginUser();
        AjaxResult payUrlResult = driverPayService.getPayQrcode(param,loginUser);
        return payUrlResult;
    }


    @ApiOperation(value = " 乘客支付", notes = "乘客支付")
    @GetMapping("/getQrcodeForDriver")
    public AjaxResult getQrcodeForDriver(PayParam param) {
        LoginUser loginUser = getLoginUser();
        AjaxResult payUrlResult = driverPayService.getQrcodeForDriver(param,loginUser);
        return payUrlResult;
    }

    @ApiOperation(value = " 驾驶员补卡", notes = "驾驶员补卡")
    @GetMapping("/driverSign")
    public AjaxResult driverSign(PayParam param) {
        LoginUser loginUser = getLoginUser();
        return toAjax(driverPayService.driverSign(loginUser,param));
    }

    @ApiOperation(value = " 驾驶员补卡", notes = "驾驶员补卡")
    @GetMapping("/toDriverSign")
    public AjaxResult toDriverSign() {
        LoginUser loginUser = getLoginUser();
        AjaxResult result = driverPayService.toDriverSign(loginUser);
        return result;
    }

}
